using UnityEngine;
using System.Collections;

public class PaddleMove : MonoBehaviour {

	public int moveSpeed = 140;  //per second
	public Transform ball;
	
	
	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
		
	void PlayerMove()
	{
		Vector3 moveDirection = Vector3.zero;
		Vector3 newPosition = Vector3.zero;
		
		if(Input.GetKey(KeyCode.DownArrow)) moveDirection.y -= 1;
		if(Input.GetKey(KeyCode.UpArrow)) moveDirection.y += 1;
		
		newPosition = moveDirection * (moveSpeed * Time.deltaTime);
		newPosition = transform.position + newPosition;
		newPosition.y = Mathf.Clamp(newPosition.y, -91.0f, 93.5f);
		
		transform.position = newPosition;
		
		if(Input.GetKey(KeyCode.Space))
		{
			Transform newBall = (Transform)Instantiate(ball,transform.position, transform.rotation) as Transform;
		}
	}
}
